package cn.iocoder.yudao.module.famous.doctor.dal.mysql.video;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.famous.doctor.dal.dataobject.video.FamVideoDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.famous.doctor.controller.admin.video.vo.*;

/**
 * 视频管理 Mapper
 *
 * @author 档案
 */
@Mapper
public interface FamVideoMapper extends BaseMapperX<FamVideoDO> {

    default PageResult<FamVideoDO> selectPage(FamVideoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FamVideoDO>()
                .eqIfPresent(FamVideoDO::getImgUrl, reqVO.getImgUrl())
                .eqIfPresent(FamVideoDO::getContent, reqVO.getContent())
                .eqIfPresent(FamVideoDO::getDiseaseLabelIds, reqVO.getDiseaseLabelIds())
                .eqIfPresent(FamVideoDO::getVideoUrl, reqVO.getVideoUrl())
                .eqIfPresent(FamVideoDO::getAuthor, reqVO.getAuthor())
                .betweenIfPresent(FamVideoDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(FamVideoDO::getTitle, reqVO.getTitle())
                .eqIfPresent(FamVideoDO::getStatus, reqVO.getStatus())
                .orderByDesc(FamVideoDO::getId));
    }

    default List<FamVideoDO> selectList(FamVideoExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<FamVideoDO>()
                .eqIfPresent(FamVideoDO::getImgUrl, reqVO.getImgUrl())
                .eqIfPresent(FamVideoDO::getContent, reqVO.getContent())
                .eqIfPresent(FamVideoDO::getDiseaseLabelIds, reqVO.getDiseaseLabelIds())
                .eqIfPresent(FamVideoDO::getVideoUrl, reqVO.getVideoUrl())
                .eqIfPresent(FamVideoDO::getAuthor, reqVO.getAuthor())
                .betweenIfPresent(FamVideoDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(FamVideoDO::getTitle, reqVO.getTitle())
                .eqIfPresent(FamVideoDO::getStatus, reqVO.getStatus())
                .orderByDesc(FamVideoDO::getId));
    }

}
